<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"  
                xmlns:h="http://java.sun.com/jsf/html"  
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                template="./../templates/StaffTemplate.xhtml">

    <ui:define name="nav_menu">
        <p:menubar model="#{staffChangeInitialPasswordManagedBean.staffMenuModel}"/>
    </ui:define>
    <ui:define name="content">
        <h:form>
            <p:panel id="panel" header="Create Service Package">
                <f:metadata>
                    <f:viewParam name ="visibility" value ="#{tCubeManagerBean.servicePackage.visibility}" />
                </f:metadata>
                <p:ajaxStatus style="width:16px;height:16px;">
                    <f:facet name="start">
                        <h:graphicImage value="http://www.primefaces.org:8080/showcase/design/ajaxloading.gif" />
                    </f:facet>
                    <f:facet name="complete">
                        <h:outputText value="" />
                    </f:facet>
                </p:ajaxStatus>
                <p:messages />
                <h:panelGrid columns="3" cellpadding="10">
                    <h:outputLabel for="name" style="font-weight: bold" value="Service package name: " />
                    <h:inputText required="true" label="Package Name" requiredMessage="Service package name is required." id="name" value="#{tCubeManagerBean.servicePackage.name}">
                    </h:inputText>
                    <p:message for="name" />

                    <h:outputLabel for="description" style="font-weight: bold" value="Description: " />
                    <p:inputTextarea required="true" label="Description" requiredMessage="Description is required." id="description" value="#{tCubeManagerBean.servicePackage.description}">
                    </p:inputTextarea>
                    <p:message for="description" />

                    <h:outputLabel for="price" style="font-weight: bold" value="Price: " />
                    <h:inputText required="true" label="Price" requiredMessage="Price is required." id="price" value="#{tCubeManagerBean.servicePackage.price}">
                    </h:inputText>
                    <p:message for="price" />

                    <h:outputLabel for="priority" style="font-weight: bold" value="Priority: " />
                    <h:selectOneMenu value="#{tCubeManagerBean.servicePackage.priority}">
                        <f:selectItems value="#{tCubeManagerBean.listOfPriority}"/>
                    </h:selectOneMenu>

                    <p:commandButton value="Visible" disabled="#{tCubeManagerBean.servicePackage.visibility}"  action="staff/TCubeAddServicePackage?faces-redirect=true" ajax="true">
                        <f:param name="visibility" value="true" />
                    </p:commandButton>

                    <p:commandButton value="Invisible" disabled="#{!tCubeManagerBean.servicePackage.visibility}" action="staff/TCubeAddServicePackage?faces-redirect=true" ajax="true">
                        <f:param name="visibility" value="false" />
                    </p:commandButton>

                    <h:outputLabel for="blank" style="font-weight: bold" value=""/>
                    <p:dataTable var="service" value="#{tCubeManagerBean.listOfServices}" selection="#{tCubeManagerBean.services}" paginator="true" rows="10">
                        <p:column selectionMode="multiple" />

                        <p:column headerText="Name">
                            <h:outputText value="#{service.name}" />
                        </p:column>

                        <p:column headerText="Description">
                            <h:outputText value="#{service.description}" />
                        </p:column>
                    </p:dataTable>
                    <p:dataTable var="analytics" value="#{tCubeManagerBean.listOfAnalytics}" selection="#{tCubeManagerBean.selectedAnalytics}" paginator="true" rows="10">
                        <p:column selectionMode="multiple" />

                        <p:column headerText="Name">
                            <h:outputText value="#{analytics.name}" />
                        </p:column>

                        <p:column headerText="Description">
                            <h:outputText value="#{analytics.description}" />
                        </p:column>
                    </p:dataTable>
                </h:panelGrid>
                <p:commandButton id="btn" value="Create New Service" update="panel" actionListener="#{tCubeManagerBean.addServicePackage}" ajax="true" />
            </p:panel>
        </h:form>
    </ui:define>
</ui:composition>


